home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Games / WHDLoad / Src / sources / whdload / blitfix_dn_58a0.s < prev    next >
Encoding:
Text File  |  2000-08-07  |  2.3 KB  |  100 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Modul.    blitfix_dn_58a0.s
  3. ;  :Contents.    routine to fix program that does not correctly wait for
  4. ;        blitter finish
  5. ;        the instruction which writes the "bltsize" register will be
  6. ;        patched with a routine which will wait for blitter finish
  7. ;        after writing "bltsize"
  8. ;  :Version.    $Id: blitfix_dn_58a0.s 1.4 2000/04/16 16:46:17 jah Exp $
  9. ;  :History.    15.03.99 created from blitfix_dn_58a5.s
  10. ;        19.03.99 checked area fixed, a2 now returns pointer
  11. ;        05.04.00 bug in patchcount fixed
  12. ;        09.04.00 interrupt blit check added
  13. ;  :Requires.    -
  14. ;  :Copyright.    Public Domain
  15. ;  :Language.    68000 Assembler
  16. ;  :Translator.    Barfly V1.131
  17. ;  :To Do.
  18. ;---------------------------------------------------------------------------*
  19. ;
  20. ; this will patch the following instructions:
  21. ;        move.w    d0,($58,a0)
  22. ;        move.w    d1,($58,a0)
  23. ;        move.w    d2,($58,a0)
  24. ;        move.w    d3,($58,a0)
  25. ;        move.w    d4,($58,a0)
  26. ;        move.w    d5,($58,a0)
  27. ;        move.w    d6,($58,a0)
  28. ;        move.w    d7,($58,a0)
  29. ;
  30. ; IN:    A0 = APTR start of memory to patch
  31. ;    A1 = APTR end of memory to patch
  32. ;    A2 = APTR space for patch routine MUST be < $8000 !!!
  33. ; OUT:    D0-D1/A0-A1 unchanged
  34. ;    A2 = APTR points to the end of patch routine
  35.  
  36. _blitfix_dn_58a0
  37.         movem.l    d0/a0-a1,-(a7)
  38.  
  39.     IFD PATCHCOUNT
  40.         clr.l    (a2)+
  41.         clr.l    (a2)+
  42.     ENDC
  43.  
  44.         subq.l    #2,a1
  45. .loop        move.w    (a0)+,d0
  46.         and.w    #$fff8,d0
  47.         cmp.w    #$3140,d0        ;move.w dx,($58,a0)
  48.         bne    .next
  49.         cmp.w    #$0058,(a0)
  50.         bne    .next
  51.         move.w    -(a0),d0        ;old opcode
  52.         move.w    #$4eb8,(a0)+        ;JSR $XXXX.w
  53.         move.w    a2,(a0)
  54.         and.w    #7,d0            ;register number
  55.  
  56.     IFD PATCHCOUNT
  57.         addq.b    #1,(-8,a2,d0.w)
  58.     ENDC
  59.  
  60.         mulu    #6,d0
  61.         add.w    d0,(a0)+        ;jmp address
  62. .next        cmp.l    a0,a1
  63.         bhs    .loop
  64.  
  65.         lea    (.wait_d0),a0
  66.         lea    (.wait_end),a1
  67. .cpy        move.w    (a0)+,(a2)+
  68.         cmp.l    a0,a1
  69.         bne    .cpy
  70.  
  71.         movem.l    (a7)+,d0/a0-a1
  72.         rts
  73.  
  74. .wait_d0    move.w    d0,($58,a0)
  75.         bra.b    .wait
  76. .wait_d1    move.w    d1,($58,a0)
  77.         bra.b    .wait
  78. .wait_d2    move.w    d2,($58,a0)
  79.         bra.b    .wait
  80. .wait_d3    move.w    d3,($58,a0)
  81.         bra.b    .wait
  82. .wait_d4    move.w    d4,($58,a0)
  83.         bra.b    .wait
  84. .wait_d5    move.w    d5,($58,a0)
  85.         bra.b    .wait
  86. .wait_d6    move.w    d6,($58,a0)
  87.         bra.b    .wait
  88. .wait_d7    move.w    d7,($58,a0)
  89. .wait        BLITWAIT a0
  90.     IFD INTBLITCHECK
  91.         move.l    d0,-(a7)
  92.         move    sr,d0
  93.         and.w    #$0700,d0
  94.         beq    .intok
  95.         illegal
  96. .intok        move.l    (a7)+,d0
  97.     ENDC
  98.         rts
  99. .wait_end
  100.